// import { selfI18n } from '@/i18n/index';
import moment from 'moment';
export default function (data) {
    var legend = data.map((item) => {
        return item.name;
    });
    const todayDate = moment().format('YYYY-MM-DD');
    const res = data;
    // const $t = selfI18n;
    // const title_map = {
    //     utilization_rate: $t('utilization_rate'),
    //     utilization_rate_and_OEE: $t('utilization_rate_and_OEE')
    // };
    return {
        tooltip: {
            trigger: 'item'
        },
        title: {
            text: todayDate + '\n 工时分布',
            top: '45%',
            left: 'center',
            textStyle: {
                fontSize: 12
            }
        },
        legend: {
            orient: 'vertical',
            left: '80%',
            top: 'middle',
            right: 'auto',
            align: 'left',
            icon: 'circle',
            itemWidth: 15,
            itemHeight: 15,
            data: legend,
            formatter: function (name) {
                for (var i = 0; i < res.length; i++) {
                    if (name === res[i].name) {
                        return (
                            name
                        );
                    }
                }
            }
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                labelLine: {
                    show: false
                },
                data: data
            }
        ]
    };
}
